<script src="${ctx}/static/js/modernizr.min.js"></script>
<script src="${ctx}/static/js/jquery.min.js"></script>
<script src="${ctx}/static/js/moment.min.js"></script>

<script src="${ctx}/static/js/popper.min.js"></script>
<script src="${ctx}/static/js/bootstrap.min.js"></script>

<script src="${ctx}/static/js/detect.js"></script>
<script src="${ctx}/static/js/fastclick.js"></script>
<script src="${ctx}/static/js/jquery.blockUI.js"></script>
<script src="${ctx}/static/js/jquery.nicescroll.js"></script>

<!-- App js -->
<script src="${ctx}/static/js/pikeadmin.js"></script>

<!-- BEGIN Java Script for this page -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap4.min.js"></script>

<!-- Counter-Up-->
<script src="${ctx}/static/plugins/waypoints/lib/jquery.waypoints.min.js"></script>
<script src="${ctx}/static/plugins/counterup/jquery.counterup.min.js"></script>

<script src="${ctx}/static/plugins/toastr/toastr.min.js"></script>
<script src="${ctx}/static/js/jquery.websocket.js"></script>
<script>
    toastr.options = {
        "positionClass": "toast-top-center"
    }

    function showSuccessMsg(msg){
        toastr.success(msg);
    }

    // 按F5只刷新中间的页面，顶部、右部、底部不刷新。
    // (当焦点在iframe里面的时候，F5按太快，会导致刷新整个页面。因为当iframe页面加载未完成的时候，按F5会导致该段JS没有加载，因此会使用浏览器的F5功能。因此在iframe里面的页面也要处理F5按键事件。)
    $(function () {
        $("body").on("keydown", function () {
            if (event.keyCode == 116) {
                //阻止浏览器的F5功能
                if (window.event) {// ie
                    try {
                        event.keyCode = 0;
                    } catch (e) {
                        console.log(e)
                    }
                    event.returnValue = false;
                } else {// firefox
                    event.preventDefault();
                }

                //设置新的F5刷新iframe页面
                var myFrame = $("#myFrame");
                console.log("myFrame");
                console.log(myFrame);
                if (myFrame.length) {
                    myFrame[0].contentWindow.location.reload();
                } else {
                    var p_iframe = $('#myFrame', window.parent.document);
                    console.log("p_iframe");
                    console.log(p_iframe);
                    if (p_iframe.length) {
                        p_iframe[0].contentWindow.location.reload();
                    } else {
                        toastr.error('F5 无效，请使用浏览器刷新按钮')
                    }
                }
            }
        });
    });
</script>